package org.spring.cloud.controller;

import java.util.Random;

import org.spring.cloud.service.SeckillService;
import org.spring.cloud.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 秒杀活动
 * @author Administrator
 */
@RequestMapping("/secikll")
@RestController
public class SeckillClientController {

	@Autowired
	private SeckillService seckillService;
	
	@RequestMapping("secikllRush")
	public Result<Boolean> secikllRush(){
		//模拟设置用户ID和秒杀数据的ID
		Random random = new Random();
		Long userId = Long.valueOf(String.valueOf(random.nextInt()));
//		Long userId = random.nextLong();
		return  this.seckillService.secikllRush(userId,1L);
	}
	
}
